#include <iostream>
#include <vector>
#include <Vector.hpp>
using namespace std;

class Solution
{
public:
    int maxArea(vector<int> &height)
    {
        int leftPoint = 0;
        int rightPoint = height.size() - 1;
        int maxArea = std::min(height[leftPoint], height[rightPoint]) * (rightPoint - leftPoint);
        while (leftPoint < rightPoint)
        {
            if (height[leftPoint] < height[rightPoint])
            {
                leftPoint++;
                maxArea = std::max(maxArea, std::min(height[leftPoint], height[rightPoint]) * (rightPoint - leftPoint));
            }
            else
            {
                rightPoint--;
                maxArea = std::max(maxArea, std::min(height[leftPoint], height[rightPoint]) * (rightPoint - leftPoint));
            }
        }
        return maxArea;
    }
};

int main()
{
    cout << "Code11" << endl;
    Solution s;
    int result = s.maxArea(std::vector<int>{1, 8, 6, 2, 5, 4, 8, 3, 7});
    cout << result << endl;
    return 0;
}